<?php

/**
 * Get valid frontend URL for current router
 *
 * @package Rapide_View
 */
class Rapide_View_Helper_FrontendUrl extends Rapide_View_Helper
{
	/**
	 * Get valid frontend URL for current router
	 *
	 * @param string $sController
	 * @param string $sAction
	 * @param array $aParameters
	 * @param string $sScheme URL scheme
	 * @return string valid frontend URL for current router
	 */
	public function execute($sController = null, $sAction = null, array $aParameters = array(), $sScheme = null)
	{
		$this->_oConfig = new Rapide_Config;
		$this->_oConfig->load('Router.php');

		$oRouter = Rapide_Controller_Front::getInstance()->getRouter();

		$oRouter->setUrlLevel($this->_oConfig->get('Router', 'frontend_url'));

		$sUrl = $oRouter->url($sController, $sAction, $aParameters, $sScheme);

		$oRouter->setUrlLevel(0);

		return $sUrl;
	}
}

?>